#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;
    int max = 0;
    int list[110];
    for (int i = 0; i < n; i++)
    {
        cin >> list[i];
        if (max == 0)
        {
            max = list[i];
        }
        if (list[i] > max)
        {
            max = list[i];
        }
    }
    
    int sum = 0;
    for (int i = 0; i < n; i++)
    {
        if (list[i] != max)
        {
            sum += list[i];
        }
    }
    cout << sum;
    
    return 0;
}